home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 2002 #11
/
Amiga Plus CD - 2002 - No. 11.iso
/
Tools
/
Freeware
/
DiskMaster
/
Rexx
/
FileShow.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
2002-10-27
|
9KB
|
315 lines
/* $VER: FileID Show v3.1 (24.08.96) (c) Inorix scripts
**
** A File_ID.diz extractor for DiskMaster II
** Written by JAVE (Jan-willem van Eys)
**
** Inspired by: FileID_DIZ READER V 2.0 ® TGI-SOFT 1994
** (A badly coded File_ID.diz display script for DOpus v4.12 :-))
**
*/
OPTIONS RESULTS
OPTIONS FAILAT 21
/*************************************/
/* Specify an alternative device to */
/* unDMS to. */
/*************************************/
ODev='FF0:'
/*************************************/
/* Get the portname */
/*************************************/
Port=ADDRESS()
/*************************************/
/* Add RexxReqTools library */
/* and Rexxtricks library */
/*************************************/
IF ~SHOW('L','rexxsupport.library') THEN DO
ADDLIB('rexxsupport.library',0,-30)
END
IF ~SHOW('L','rexxreqtools.library') THEN DO
ADDLIB('rexxreqtools.library',0,-30)
END
IF ~SHOW('L','rexxtricks.library') THEN DO
ADDLIB('rexxtricks.library',0,-30)
END
/*************************************/
/* Get the selected file */
/*************************************/
PARSE ARG DMSource DestPath .
/*************************************/
/* Split the Source in Filename and */
/* Path vars. */
/*************************************/
DMFile=FILEPART(DMSource)
DMPath=PATHPART(DMSource)
/*************************************/
/* If there's no destination dir */
/* selected, set it to the source. */
/* (and add a '/' if it's not there) */
/*************************************/
IF DestPath="" THEN DestPath=DMPath
IF ~(RIGHT(DestPath,1)=':') THEN DestPath=DestPath'/'
/*************************************/
/* Set some vars */
/*************************************/
Title='FileID Show v3.1 (24.08.96)'
NL='0a'x
QT='"'
Tag="rt_reqpos=reqpos_centerscr rt_pubscrname="||port
Gadgets='_Action|_Delete|_Quit'
/*************************************/
/* Check if DiskMaster is the caller */
/* Exit otherwise */
/*************************************/
IF ~(LEFT(Port,2)='DM') THEN DO
SAY
SAY 'This script will only run from within DiskMaster II!'
SAY
EXIT 10
END
/*************************************/
/* Determine the archive type by */
/* calling my file recognition */
/* subroutine */
/*************************************/
CALL Sub_FileRecog.REXX(DMSource)
Filetype=GETCLIP(FR_T)
Archtype=GETCLIP(FR_S)
IF ~(Archtype='GUIDE'|Archtype='GIF'|Archtype='EXE') THEN DO
IF RIGHT(Filetype,7)~='Archive' THEN DO
Archtype='???'
END
END
/*************************************/
/* Make a var containing the source */
/* filename surrounded by "'s */
/*************************************/
SelectedFile=QT||DMSource||QT
/*************************************/
/* Delete possible old File_ID.diz */
/* and extract the File_ID.diz from */
/* the sourcefile */
/*************************************/
IF EXISTS('T:FILE_ID.DIZ') THEN 'DELETE T:File_ID.diz'
SELECT
WHEN ArchType='DMS' THEN DO
'Extern dmsdescript >NIL: x T:FILE_ID.diz '||SelectedFile
END
WHEN (ArchType='LHA'|ArchType='LZH') THEN DO
'Extern lha x >NIL: '||SelectedFile||' FILE_ID.DIZ T:'
END
WHEN ArchType='LZX' THEN DO
'Extern lzx x >NIL: '||SelectedFile||' FILE_ID.DIZ T:'
END
WHEN ArchType='GUIDE' THEN DO
'Extern TxtExtract e >NIL: T:FILE_ID.DIZ '||SelectedFile
END
WHEN ArchType='EXE' THEN DO
ADDRESS command 'EXEDescript x >NIL: T:FILE_ID.DIZ '||SelectedFile
END
WHEN ArchType='ZIP' THEN DO
olddirectory=PRAGMA('D','T:')
ADDRESS COMMAND 'Unzip >NIL: '||SelectedFile||'FILE_ID.DIZ '
PRAGMA('D',olddirectory)
END
WHEN ArchType='GIF' THEN DO
olddirectory=PRAGMA('D','T:')
ADDRESS COMMAND 'Gifdesc e >NIL: '||SelectedFile||'FILE_ID.DIZ '
PRAGMA('D',olddirectory)
END
OTHERWISE DO
SAY 'Unknown Archive format!'
EXIT
END
END
/*************************************/
/* If no FileID was found, say so in */
/* the displaytext */
/*************************************/
Showtext=""
IF ~EXISTS('T:FILE_ID.DIZ') THEN DO
Showtext='No File_ID.diz found!'
END
/*************************************/
/* Fill the displaytext with the */
/* FileID */
/*************************************/
ELSE DO
CALL OPEN('FileID','T:FILE_ID.diz','r')
DO UNTIL EOF('FileID')
Showtext=Showtext||NL||READLN('FileID')
END
CALL CLOSE('FileID')
Showtext=STRIP(Showtext,'B',NL)
END
/*************************************/
/* Ask user for response */
/*************************************/
actieresult=rtezrequest(Showtext,Gadgets,Title,Tag,)
SELECT
WHEN actieresult=1&Archtype="DMS" THEN CALL DMS
WHEN actieresult=1&Archtype="LHA" THEN CALL LHA
WHEN actieresult=1&Archtype="LZX" THEN CALL LZX
WHEN actieresult=1&Archtype="ZIP" THEN CALL ZIP
WHEN actieresult=1 THEN CALL Other
WHEN actieresult=2 THEN CALL Deleting
OTHERWISE EXIT
END
EXIT
/*********************************************************
* Delete file subroutine
*********************************************************/
Deleting:
deletetext="Are you SURE you want to delete"||NL||DMFile"?"
Gadgets="_Delete|_Quit"
delresult=rtezrequest(deletetext,Gadgets,Title,Tag,)
IF delresult=1 THEN 'DELETE 'DMSource
RETURN
/*********************************************************
* DMS Subroutine
*********************************************************/
DMS:
dmstext="Where do you want to unDMS"||NL||DMFile" to?"
Gadgets="DF_0:|DF_1:|_"ODev"|_Quit"
dmsresult=rtezrequest(dmstext,Gadgets,Title,Tag,)
IF dmsresult=1 THEN DO
'StdIO "CON:108/42/424/180/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:DMS <* WRITE 'SelectedFile' TO DF0: NOTEXT NOVERIFY NOPAUSE'
'Wait'
'StdIO CLOSE'
END
IF dmsresult=2 THEN DO
'StdIO "CON:108/42/424/180/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:DMS <* WRITE 'SelectedFile' TO DF1: NOTEXT NOVERIFY NOPAUSE'
'Wait'
'StdIO CLOSE'
END
IF dmsresult=3 THEN DO
'StdIO "CON:108/42/424/180/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:DMS <* WRITE 'SelectedFile' TO 'ODev' NOTEXT NOPAUSE'
'Wait'
'StdIO CLOSE'
END
IF RC ~=0 THEN DO
SAY "DMS ERROR -> "||RESULT
END
RETURN
/*********************************************************
* LhA Subroutine
*********************************************************/
LHA:
lhatext="Extract "DMFile" to?"
Gadgets="_Destination|_RAM|_Quit"
lharesult=rtezrequest(lhatext,Gadgets,Title,Tag,)
IF lharesult=1 THEN DO
'StdIO "CON:0/11/640/253/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:LhA <* x 'SelectedFile' -M 'DestPath
'StdIO CLOSE'
END
IF lharesult=2 THEN DO
'StdIO "CON:0/11/640/253/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:LhA <* x 'SelectedFile' -M RAM:'
'StdIO CLOSE'
END
RETURN
/*********************************************************
* LZX SubRoutine
*********************************************************/
LZX:
lzxtext="Extract "DMFile" to?"
Gadgets="_Destination|_RAM|_Quit"
lzxresult=rtezrequest(lzxtext,Gadgets,Title,Tag,)
IF lzxresult=1 THEN DO
'StdIO "CON:0/11/640/253/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:LZX <* x 'SelectedFile' 'DestPath
'StdIO CLOSE'
END
IF lzxresult=2 THEN DO
'StdIO "CON:0/11/640/253/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern C:LZX <* x 'SelectedFile' RAM:'
'StdIO CLOSE'
END
RETURN
/*********************************************************
* Zip SubRoutine
*********************************************************/
ZIP:
ziptext="Extract "DMFile"?"
Gadgets="_Destination|_RAM|_Quit"
zipresult=rtezrequest(ziptext,Gadgets,Title,Tag,)
IF zipresult=1 THEN DO
'StdIO "CON:0/11/640/253/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern CD %d \C:UnZip <* 'SelectedFile
'StdIO CLOSE'
END
IF zipresult=2 THEN DO
'StdIO "CON:0/11/640/253/Extract Window/Close/Smart/Plain/Nogads/Screen"||port'
'Extern CD RAM: \C:UnZip <* 'SelectedFile
'StdIO CLOSE'
END
RETURN
/*********************************************************
* Unknown archive Subroutine
*********************************************************/
/*************************************/
/* In case of unknown archive, (it's */
/* probably a GIF picture or some */
/* docfile) use the */
/* AutoCmd description associated */
/* with the File (or the DEFAULT one */
/* if unknown...) */
/*************************************/
Other:
othertext=DMFile
Gadgets="_View|_Quit"
othresult=rtezrequest(othertext,Gadgets,Title,Tag,)
IF othresult=1 THEN DO
'auto 'DMSource
EXIT
END
RETURN